package com.travel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.travel.entity.po.CityInfo;
import com.travel.mapper.CityInfoMapper;
import com.travel.service.CityInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Author:Jasenon_ce
 * Date: 2025.05.29/下午5:01
 */
@Service
public class CityInfoServiceImpl implements CityInfoService {

    @Autowired
    private CityInfoMapper cityInfoMapper;

    @Override
    public List<String> getAllSupportedCities() {
        return cityInfoMapper.getAllSupportedCities();
    }

    @Override
    public boolean insert(CityInfo cityInfo) {
        return cityInfoMapper.insert(cityInfo) > 0;
    }

    @Override
    public CityInfo getCityInfoByCityName(String cityName) {
        QueryWrapper<CityInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("city_name", cityName);
        return cityInfoMapper.selectOne(queryWrapper);
    }

}
